<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="inner"></div>
    <div class="create"></div>
    <script>
        //三种创建元素的方法
        //1.document.write();
        // window.onload = function() {
        //         document.write("<div>123</div>");
        //     }
        //2.innerHTML
        //字符拼接方式
        var inner = document.querySelector(".inner");
        for (var i = 0; i < 100; i++) {
            inner.innerHTML += '<a href="#">百度</a>';
        }
        //数组形式
        var inner = document.querySelector(".inner");
        var arr = [];
        for (var i = 0; i < 100; i++) {
            arr.push('<a href="#">百度</a>');
        }
        inner.innerHTML = arr.join("");
        // inner.innerHTML = '<a href="#">百度</a>';
        //3.createElemment
        var create = document.querySelector(".create");
        var a = document.createElement("a");
        create.appendChild(a);
    </script>
</body>

</html>